﻿using System;
using System.Collections.Generic;

using MugenMvvmToolkit.Interfaces;

namespace MugenMvvmToolkitTest.TestModels
{
    public class TestValidationResult : IValidationResult
    {
        #region Constructors

        /// <summary>
        ///     Initializes a new instance of the <see cref="TestValidationResult" /> class.
        /// </summary>
        public TestValidationResult(string errorMessage, params string[] memberNames)
        {
            if (errorMessage == null) throw new ArgumentNullException("errorMessage");
            if (memberNames == null) throw new ArgumentNullException("memberNames");
            ErrorMessage = errorMessage;
            MemberNames = memberNames;
        }

        #endregion

        #region Implementation of IValidationResult

        /// <summary>
        ///     Gets the value which contains validation result.
        /// </summary>
        public bool IsValid
        {
            get { return false; }
        }

        /// <summary>
        ///     Gets the collection of member names that indicate which fields have validation errors.
        /// </summary>
        /// <returns>
        ///     The collection of member names that indicate which fields have validation errors.
        /// </returns>
        public IEnumerable<string> MemberNames { get; set; }

        /// <summary>
        ///     Gets the error message for the validation.
        /// </summary>
        /// <returns>
        ///     The error message for the validation.
        /// </returns>
        public string ErrorMessage { get; set; }

        #endregion

        #region Overrides of Object

        /// <summary>
        ///     Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        ///     A string that represents the current object.
        /// </returns>
        public override string ToString()
        {
            return ErrorMessage;
        }

        #endregion
    }
}